package org.hqs.admin.service;

import org.hqs.admin.mapper.AdminMapper;
import org.hqs.admin.pojo.Admin;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class AdminService {

    @Autowired
    private AdminMapper adminMapper;

    public Admin queryAdminById(Long adminId) {
        return adminMapper.findById(adminId);
    }

    public List<Admin> findAllAdmins() {
        return adminMapper.findAllAdmins();
    }

    public int insertAdmin(Admin admin) {
        return adminMapper.insertAdmin(admin);
    }

    // 更新管理员信息
    public int updateAdmin(Admin admin) {

        return adminMapper.updateAdmin(admin);
    }

    // 删除管理员信息
    public int deleteAdmin(Admin admin) {
        return adminMapper.deleteAdmin(Long.valueOf(admin.getId()));
    }
}
